/**
 * scroll to top
 */

export default {
  toTop: () => {
    let distance = document.documentElement.scrollTop || document.body.scrollTop
    const step = distance / 30
    const jump = () => {
      if (distance > 0) {
        distance -= step
        window.scrollTo(0, distance)
        setTimeout(jump, 10)
      }
    }
    jump()
  }
}
